const Router = require('koa-router')
const { Comments } = require('../../models/comments')
const { Auth } = require('../../core/middleware/auth')
const router = new Router({
  prefix: '/v1/comments',
})
router.post('/create', new Auth().m, async (ctx, next) => {
  const { postid, content, imgs } = ctx.request.body
  const list = await Comments.createComment({ postid, userid: ctx.auth.id, content, imgs })
  ctx.body = {
    code: 200,
    data: list,

  }
})
module.exports = router

